Namespaces

Types in MathNet.Numerics.Statistics.Mcmc

Type MetropolisHastingsSampler<T>

Namespace MathNet.Numerics.Statistics.Mcmc

Parent McmcSampler<T>

Metropolis-Hastings sampling produces samples from distribution P by sampling from a proposal distribution Q and accepting/rejecting based on the density of P. Metropolis-Hastings sampling doesn't require that the proposal distribution Q is symmetric in comparison to . It does need to be able to evaluate the proposal sampler's log density though. All densities are required to be in log space. The Metropolis-Hastings sampler is a stateful sampler. It keeps track of where it currently is in the domain of the distribution P.

Constructors

Methods

Properties

Public Constructors

MetropolisHastingsSampler<T>(T x0, DensityLn<T> pdfLnP, TransitionKernelLn<T> krnlQ, LocalProposalSampler<T> proposal, int burnInterval)

Constructs a new Metropolis-Hastings sampler using the default Random random number generator. This constructor will set the burn interval.
Parameters
T x0

The initial sample.

DensityLn<T> pdfLnP

The log density of the distribution we want to sample from.

TransitionKernelLn<T> krnlQ

The log transition probability for the proposal distribution.

LocalProposalSampler<T> proposal

A method that samples from the proposal distribution.

int burnInterval

The number of iterations in between returning samples.

Public Methods

bool Equals(object obj)

int GetHashCode()

Type GetType()

T Sample()

Returns a sample from the distribution P.

T[] Sample(int n)

Returns a number of samples.
Parameters
int n

The number of samples we want.

Return
T[]

An array of samples.

string ToString()

Public Properties

double AcceptanceRate get;

int BurnInterval get; set;

Gets or sets the number of iterations in between returning samples.

Random RandomSource get; set;